// 导入定义路由的方法
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
// 定义路由
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: 'index',
        component: () => import('../views/index/index.vue')
      },
      {
        path: 'advert',
        component: () => import('../views/advert/index.vue'),
        children: [
          {
            path: 'publish',
            component: () => import('../views/advert/add.vue')
          },
          {
            path: 'list',
            component: () => import('../views/advert/list.vue')
          },
        ]
      },
      {
        path: 'navigate',
        component: () => import('../views/navigate/index.vue'),
        children: [
          {
            path: 'add',
            component: () => import('../views/navigate/add.vue')
          },
          {
            path: 'list',
            component: () => import('../views/navigate/list.vue')
          },
        ]
      },
      {
        path: 'article',
        component: () => import('../views/article/index.vue'),
        children: [
          {
            path: 'add',
            component: () => import('../views/article/add.vue')
          },
          {
            path: 'list',
            component: () => import('../views/article/list.vue')
          },
        ]
      },
      {
        path: 'content',
        component: () => import('../views/content/index.vue'),
        children: [
          {
            path: 'add',
            component: () => import('../views/content/add.vue')
          },
          {
            path: 'list',
            component: () => import('../views/content/list.vue')
          },
        ]
      },
      {
        path: 'video',
        component: () => import('../views/video/index.vue'),
        children: [
          {
            path: 'add',
            component: () => import('../views/video/add.vue')
          },
          {
            path: 'list',
            component: () => import('../views/video/list.vue')
          },
        ]
      },
      {
        path: 'user',
        component: () => import('../views/user/index.vue'),
        children: [
          {
            path: 'list',
            component: () => import('../views/user/list.vue')
          },
          {
            path: 'admin',
            component: () => import('../views/user/admin.vue')
          },
        ]
      },
      {
        path: 'signin',
        component: () => import('../views/signin/index.vue'),
        children: [
          {
            path: 'list',
            component: () => import('../views/signin/list.vue')
          }
        ]
      },
      {
        path: 'comment',
        component: () => import('../views/comment/index.vue'),
        children: [
          {
            path: 'article',
            component: () => import('../views/comment/article.vue')
          },
          {
            path: 'content',
            component: () => import('../views/comment/content.vue')
          }
        ]
      },
      {
        path: 'reply',
        component: () => import('../views/reply/index.vue'),
        children: [
          {
            path: 'article',
            component: () => import('../views/reply/article.vue')
          },
          {
            path: 'content',
            component: () => import('../views/reply/content.vue')
          }
        ]
      },
      {
        path: 'base',
        component: () => import('../views/base/index.vue'),
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/user/login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/user/register.vue')
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/TestView.vue')
  },
  {
    path: '/:catchAll(.*)',
    component: () => import('../views/Not.vue')
  },
]
// 创建路由
const router = createRouter({
  // 采用hash模式/路由模式路径带#号
  history: createWebHashHistory(),
  // 设置路由
  routes
})
// 导出路由
export default router
